package com.ruoyi.member.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.member.domain.FamilyUserRelation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.member.mapper.FamilyUserRelationMapper;
import com.ruoyi.member.service.IFamilyUserRelationService;

/**
 * 用户和家庭关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-20
 */
@Service
public class FamilyUserRelationServiceImpl implements IFamilyUserRelationService 
{
    @Autowired
    private FamilyUserRelationMapper familyUserRelationMapper;

    /**
     * 查询用户和家庭关联
     * 
     * @param id 用户和家庭关联主键
     * @return 用户和家庭关联
     */
    @Override
    public FamilyUserRelation selectFamilyUserRelationById(Long id)
    {
        return familyUserRelationMapper.selectFamilyUserRelationById(id);
    }

    /**
     * 查询用户和家庭关联列表
     * 
     * @param familyUserRelation 用户和家庭关联
     * @return 用户和家庭关联
     */
    @Override
    public List<FamilyUserRelation> selectFamilyUserRelationList(FamilyUserRelation familyUserRelation)
    {
        return familyUserRelationMapper.selectFamilyUserRelationList(familyUserRelation);
    }

    /**
     * 新增用户和家庭关联
     * 
     * @param familyUserRelation 用户和家庭关联
     * @return 结果
     */
    @Override
    public int insertFamilyUserRelation(FamilyUserRelation familyUserRelation)
    {
        familyUserRelation.setCreateTime(DateUtils.getNowDate());
        return familyUserRelationMapper.insertFamilyUserRelation(familyUserRelation);
    }

    /**
     * 修改用户和家庭关联
     * 
     * @param familyUserRelation 用户和家庭关联
     * @return 结果
     */
    @Override
    public int updateFamilyUserRelation(FamilyUserRelation familyUserRelation)
    {
        return familyUserRelationMapper.updateFamilyUserRelation(familyUserRelation);
    }

    /**
     * 批量删除用户和家庭关联
     * 
     * @param ids 需要删除的用户和家庭关联主键
     * @return 结果
     */
    @Override
    public int deleteFamilyUserRelationByIds(Long[] ids)
    {
        return familyUserRelationMapper.deleteFamilyUserRelationByIds(ids);
    }

    /**
     * 删除用户和家庭关联信息
     * 
     * @param id 用户和家庭关联主键
     * @return 结果
     */
    @Override
    public int deleteFamilyUserRelationById(Long id)
    {
        return familyUserRelationMapper.deleteFamilyUserRelationById(id);
    }
}
